Skip to content

test: grid3d's seams are pinned, and the import test no longer leaves a second copy of grid3d - #86

Merged
dmccoystephenson merged 1 commit into
mainfrom
test/grid3d-seams
Nov 21, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
test/grid3d-seams

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

This change adds tests only. It comes before a ports-and-adapters refactor of the grid3d views
(a separate PR stacked on this one), so the behaviour that refactor must keep is pinned on
today's code first.

  • test_grid3d_seams.py (41 tests) pins every place the desktop and browser views touch
    the outside world:
    • PlatformRelay's string marshalling (JSON options, base64 messages, int() status,
      str() state, json.loads poll, reduced motion read as an int) and its "no 3D view" message
    • pageObject answering only under emscripten
    • Grid3DView.open in a browser (reducedMotion or None, the clock and title passed through,
      a failed: reason)
    • the SDL_VIDEODRIVER and GALLIUM_DRIVER defaults, which never override a set value, and
      nothing touched on an unsupported system
    • the desktop camera's near/far planes and sun, held equal to web.NEAR_PLANE, FAR_PLANE
      and SUN_DIRECTION
    • when each view reads its clock
    • what the web view sends and when: sent / lastSent, nothing before a board, no VIEW
      without a camera, nothing on a limit error, lights checked before sending, the animator's tick
    • savePng, close, ready and failure() on the web view
    • the two views' event shapes and view.strata
    • insetFractions at height 0, GRAPHIK_TOUCH (exactly "1", never in a browser), set3D's
      coercion, templatePath("2D")'s temp path, and the scancode table
  • A test-isolation bug was fixed. test_importing_grid3d_loads_neither_strata_nor_pygame
    deleted every preponderous.graphik.grid3d* module and re-imported the package, leaving the
    new copies behind. Tests that ran after it held the old classes, while Grid3DView.open's lazy
    from .web import ... loaded the new ones, so pytest.raises(Unavailable) could miss the
    Unavailable actually raised. One of the new tests hit this. The deleted modules are now put
    back through monkeypatch when the test ends.

No production code was changed.

Test plan

  • Full suite, Python 3.12 with strata-engine 0.8.0: 493 → 534 passed, 0 skipped, 0 failed
    (the same with GRAPHIK_REQUIRE_STRATA=1)
  • The CI render job's command (grid3d only, llvmpipe, GRAPHIK_REQUIRE_STRATA=1):
    312 → 353 passed
  • test_grid3d_scene.py, test_grid3d_seams.py and test_grid3d_web.py were run together in
    that order; before the fix the seams test failed there

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

… a second copy of grid3d

Characterization tests were added for every place the grid3d views touch
the outside world, ahead of a ports-and-adapters refactor: the page relay's
string marshalling, pygbag's page objects, the browser branch of
Grid3DView.open, the SDL and Gallium environment defaults, the shared
projection and sun, clock reads, what the web view sends and when, the two
views' event shapes, GRAPHIK_TOUCH, set3D, the 2D template's temp path and
the scancode table. All 41 pass on the code as it is.

test_importing_grid3d_loads_neither_strata_nor_pygame deleted every grid3d
module and re-imported the package, leaving the new copies in sys.modules.
Tests that ran after it held the old classes while Grid3DView.open's lazy
import of web loaded the new ones, so pytest.raises(Unavailable) could miss
the Unavailable it raised. The deleted modules are now put back through
monkeypatch once the test ends.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LYNeuoCqxFpUXrFhxnTg89
@dmccoystephenson
dmccoystephenson merged commit 2b411e3 into main Nov 21, 2026
7 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/grid3d-seams branch November 21, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant